﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CheckStock.aspx.cs" Inherits="SalesManagement.Modules.Warehouse.CheckStock" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Kỳ kiểm kho</title>

    <script type="text/javascript">
        function DocumentReady() {
            var obj = document.getElementById('ResourceManager1');
            MethodNamespace.DocumentReady({
                success: function() {

                }
            });
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="MethodNamespace">
        <Listeners>
            <DocumentReady Handler="DocumentReady();" Delay="100" />
        </Listeners>
    </ext:ResourceManager>
    <ext:Store ID="storeWarehouse" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="WarehouseId">
                <Fields>
                    <ext:RecordField Name="WarehouseId" />
                    <ext:RecordField Name="WarehouseName" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="storeCategory" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="CategoryId">
                <Fields>
                    <ext:RecordField Name="CategoryId" />
                    <ext:RecordField Name="CategoryName" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Viewport ID="ViewPort1" runat="server" Layout="RowLayout">
        <Items>
            <ext:Toolbar ID="tbMain" runat="server">
                <Items>
                    <ext:ToolbarSpacer />
                    <ext:Button ID="btnSave" runat="server" Text="Cập nhật" Icon="Tablesave">
                        <DirectEvents>
                            <Click OnEvent="btnSaveExit_Click" />
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button ID="Button1" runat="server" Text="Lưu" Icon="Disk">
                        <DirectEvents>
                            <Click OnEvent="btnSave_Click" />
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button ID="Button2" runat="server" Text="Thoát" Icon="Decline">
                        <DirectEvents>
                            <Click OnEvent="btnExit_Click" />
                        </DirectEvents>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
            <ext:Panel ID="Panel0" runat="server" Frame="true" Layout="FormLayout" Border="false">
                <Defaults>
                    <ext:Parameter Name="Anchor" Value="99%">
                    </ext:Parameter>
                </Defaults>
                <Items>
                    <ext:ComboBox ID="cboWarehouse" FieldLabel="Kho hàng" runat="server" Editable="false"
                        DataIndex="Title" StoreID="storeWarehouse" DisplayField="WarehouseName" ValueField="WarehouseId" />
                    <ext:DateField ID="dateStart" FieldLabel="Thời gian" runat="server" Format="dd/M/yyyy" />
                    <ext:TextArea ID="txtNote" FieldLabel="Ghi chú" runat="server" />
                    <ext:FieldSet ID="FieldSet2" runat="server" Title="Thông tin phiếu" LabelWidth="75">
                        <Items>
                            <ext:ColumnLayout ID="ColumnLayout1" runat="server" FitHeight="true">
                                <Columns>
                                    <ext:LayoutColumn ColumnWidth="0.5">
                                        <ext:ComboBox ID="cboCategory" runat="server" FieldLabel="Nhóm hàng" Editable="false"
                                            DataIndex="Title" StoreID="storeCategory" DisplayField="CategoryName" ValueField="CategoryId">
                                        </ext:ComboBox>
                                    </ext:LayoutColumn>
                                    <ext:LayoutColumn ColumnWidth="0.25">
                                        <ext:Button ID="Button3" runat="server" Text="Cập nhật hàng tồn sổ sách">
                                           <%-- <DirectEvents>
                                                <Click OnEvent="btnUpdate_Click" />
                                            </DirectEvents>--%>
                                            <Listeners>
                                                <Click Handler="storeStockCheck.reload()" />
                                            </Listeners>
                                        </ext:Button>
                                    </ext:LayoutColumn>
                                    <ext:LayoutColumn ColumnWidth="0.25">
                                        <ext:Button ID="Button4" runat="server" Text="Nhập số lượng kiểm kho">
                                            <DirectEvents>
                                                <Click OnEvent="btnInput_Click" />
                                            </DirectEvents>
                                        </ext:Button>
                                    </ext:LayoutColumn>
                                </Columns>
                            </ext:ColumnLayout>
                        </Items>
                    </ext:FieldSet>
                </Items>
            </ext:Panel>
            <ext:GridPanel ID="grStock" runat="server" AutoExpandColumn="ProductName" Border="false"
                RowHeight="1">
                <Store>
                    <ext:Store ID="storeStockCheck" runat="server" OnRefreshData="grStock_OnRefreshData"
                        AutoLoad="true" RemotePaging="true">
                        <Reader>
                            <ext:JsonReader IDProperty="ProductId">
                                <Fields>
                                    <ext:RecordField Name="ProductId" />
                                    <ext:RecordField Name="ProductCode" />
                                    <ext:RecordField Name="ProductName" />
                                    <ext:RecordField Name="UnitId" />
                                    <ext:RecordField Name="UnitName" />
                                    <ext:RecordField Name="Quantity" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel2" runat="server">
                    <Columns>
                        <ext:Column ColumnID="ProductCode" DataIndex="ProductCode" Header="Mã hàng" />
                        <ext:Column DataIndex="ProductName" Header="Tên hàng" />
                        <ext:Column DataIndex="UnitName" Header="Đơn vị tính" />
                        <ext:Column DataIndex="Quantity" Header="Số lượng" />
                        <ext:Column DataIndex="Quantity" Header="Số lượng thực tế" />
                    </Columns>
                </ColumnModel>
                <BottomBar>
                    <ext:PagingToolbar ID="PagingToolBar2" runat="server" PageSize="10" />
                </BottomBar>
                <LoadMask ShowMask="true" />
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    </form>
</body>
</html>
